/* eslint-disable no-unused-vars */
'use strict'

const Controller = require('egg').Controller

class ChatController extends Controller {
    async ping() {
        const { ctx, app } = this
        const message = ctx.args[0]
        console.log('caht控制台打印：' + message)
        ctx.socket.emit('res', `我在服务端接收到了数据你发送的数据->${message}`)
    }
}

module.exports = ChatController

// 或者是一个异步函数
// module.exports = app => {
//     return function* () {
//       const self = this;
//       const message = this.args[0];
//       console.log('chat 控制器打印', message);
//       this.socket.emit('res', `Hi! I've got your message: ${message}`);
//     };
//   };
